﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SoIM
{
    /// <summary>
    /// 组节点
    /// </summary>
    /// <remarks>2013-10-30 by sutroon</remarks>
    public partial class ucGroupNode : UserControl, IUserNode
    {
        public int NodeIndex { get; set; }
        public string NodeText { get { return this.lblName.Text; } set { this.lblName.Text = value; } }
        int nodelevel;
        public int NodeLevel
        {
            get { return nodelevel; }
            set
            {
                nodelevel = value;
                this.Margin = new Padding(value * 20, 3, 3, 3);
            }
        }

        public NodeStates NodeState { get; set; }

        public IList<Control> Nodes { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Func<ucGroupNode, string> ExpandAndCollapseHandler
        {
            set
            {
                btnSwitch.Click += (object sender, EventArgs e) =>
                {
                    value(this);
                };
            }
        }
        public Button SwitchButton { get { return this.btnSwitch; } }
        public ucGroupNode()
        {
            InitializeComponent();
            this.Nodes = new List<Control>();
        }
    }
}
